package 第七周.homework;
//计算若干个MonetaryCoin的对象的和，演示一个MonetaryCoin对象继承了其父类的抛硬币功能。
public class MonetaryCoinTest
{
    public static void main(String []args)
    {
      MonetaryCoin[] one = new MonetaryCoin[4];
      //初始化数组one中的值.
        one[0]=new MonetaryCoin(1);
        one[1]=new MonetaryCoin(2);
        one[2]=new MonetaryCoin(3);
        one[3]=new MonetaryCoin(4);
        //compute the sum of subjects.
        int sum = 0;
        for(int a =0;a<one.length;a++) {
            sum += one[a].getfaceValue();
        }
        System.out.println(sum);

        //demonstrates the function of flip coin.
        one[0].flip();
        one[1].flip();
        one[2].flip();
        one[3].flip();
//        for(int a =0;a<one.length;a++){
//          System.out.println(one[a].toString());
//        }
        for(MonetaryCoin ONE:one){
            System.out.println(ONE.toString());
    }
    }
}
